<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <script>
            /* 
                https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array

                Array.isArray()
                    - 用来检查一个对象是否是数组    

                at()
                    - 可以根据索引获取数组中的指定元素
                    - at可以接收负索引作为参数
                concat()
                    - 用来连接两个或多个数组
                    - 非破坏性方法，不会影响原数组，而是返回一个新的数组
            
            */

            // console.log(Array.isArray({ name: "孙悟空" })) // false
            // console.log(Array.isArray([1, 2, 3])) // true

            const arr = ["孙悟空", "猪八戒", "沙和尚", "唐僧"]

            // console.log(arr.at(-2))
            // console.log(arr[arr.length - 2])

            const arr2 = ["白骨精", "蜘蛛精", "玉兔精"]

            let result = arr.concat(arr2, ["牛魔王","铁扇公主"])

            console.log(result)
            

        </script>
    </head>
    <body></body>
</html>
